<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
<HTML>
  <HEAD><TITLE>Items</TITLE></HEAD>
  <SCRIPT SRC="collection.js">
  </SCRIPT>
  <SCRIPT>
var items = new collection();

function update_display() {
  var form = document.forms[0];
  var items_pane = form.items;
  items_pane.value = "";
  items.forall(
    function update_with_item(x) { 
      items_pane.value = items_pane.value + " " + x; 
    }
  );
}
 
function add_item() {
  var form = document.forms[0];
  var item = form.new_item.value;
  items.add(item);
  update_display();
}
  </SCRIPT>
  <BODY>
    <FORM ID="theform" METHOD = "post" NAME = "login" ACTION="javascript: add_item();">
      New Item: <INPUT TYPE = "text" NAME = "new_item"/><BR>
      <INPUT TYPE="submit" NAME="add_item" VALUE = "Add Item"/><BR>
      <HR/>
      Items: <INPUT TYPE = "textarea" NAME = "items" COLS = 40 ROWS = 10/>
    </FORM>
  </BODY>
</HTML>


